'use strict';

var debug = require('debug')('dao_user');
var userImpl = require('./dao_impl/user.js');

function MongoDao() {
	var self = this instanceof MongoDao ? this : new MongoDao();
	return self;
}

module.exports = new MongoDao();
var theProto = MongoDao.prototype;

/*
{
	"email": "aa@bb.com",
	"phone": "13144025450",
	"name": "wzq",
	"password": "abc123",
	"rps": [{
		"orgnization": "xxid",
		"roles": "xxid"
	}]
}
*/
theProto.create = function(json) {
	// TODO check orgnization, roles exists
	return userImpl.create(json);
};

theProto.update = function(json) {
	return userImpl.update(json);
};

theProto.read = function(json) {
	return userImpl.read(json);
};

theProto.readById = function(id) {
	return userImpl.readById(id);
}

theProto.verify = function(json) {
	return userImpl.verify(json);
};

theProto.remove = function(json) {
	return userImpl.remove(json);
}